import xadmin

from .models import ItemClass,ContentList,FileList
from xadmin import views
from xadmin.layout import Main, TabHolder, Tab, Fieldset, Row, Col, AppendedText, Side, Field

class ItemClassAdmin(object):
    list_display = ['name', 'desc', 'is_root','parent','is_abort','sort']
    search_fields = ['name', 'desc', ]
    list_filter = ['name', 'desc', 'is_root']
    ordering = ['sort']
    model_icon = 'fa fa-cog'
xadmin.site.register(ItemClass,ItemClassAdmin)

class ContentListAdmin(object):
    list_display = ['name', 'itemclassid', 'filelist_col','peoples','publish_time','add_time']
    search_fields = ['name', 'content', ]
    list_filter = ['name', 'itemclassid',]
    ordering = ['-publish_time']
    model_icon = 'fa fa-cog'
xadmin.site.register(ContentList,ContentListAdmin)

class FileListAdmin(object):
    list_display = ['name', 'contentlistid', 'url','add_time']
    search_fields = ['name', 'contentlistid', ]
    list_filter = ['contentlistid',]
    ordering = ['-add_time']
    model_icon = 'fa fa-cog'
xadmin.site.register(FileList,FileListAdmin)